package com.boruishangge.aplus_app;

import com.boruishangge.common.APlushConstant;
import com.boruishangge.aplus_app.uitls.CrashHandler;
import com.boruishangge.aplus_app.uitls.SDkInitUitls;
import com.boruishangge.persagysdk.base.AppApplicationContext;
import com.boruishangge.persagysdk.base.BaseApplication;
import com.boruishangge.persagysdk.uitls.AppUtils;
import com.boruishangge.persagysdk.uitls.Logger;

import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;

public class APlusApplication extends BaseApplication {

    @Override
    public void onCreate() {
        super.onCreate();
        init();
    }
    private  void  init(){
        AppApplicationContext.application=this;
        AppApplicationContext.context=getApplicationContext();
        SDkInitUitls.initARoute();
        SDkInitUitls.initLiveBusEvent();
//        TaskBuildProject.startProject();

        if (AppUtils.isDebugMode(this)){
            CrashHandler.getInstance().init(this,this,"/sdcard/aplus/");
        }
        setRxJavaErrorHandler();
        APlushConstant.setWebUrl("http://47.108.166.49:9555/BimWanDah5");
    }

    private void setRxJavaErrorHandler() {
        RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                Logger.d("kl---RxJavaErrorHandler---"+throwable.getMessage());
            }
        });
    }






}
